home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr32
/
moufun.zip
/
MOUDEMO3.C
next >
Wrap
C/C++ Source or Header
|
1995-04-19
|
3KB
|
120 lines
#include <graph.h>
#include <dos.h>
#include <time.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <bios.h>
#include "mou.h"
#include "moufun.c"
#pragma check_stack(off) /* turn off stack checks so that functions */
/* can be called from interrupt routines */
void menu1(void);
void menu2(void);
int menone = 'n';
void main(void)
{
int numbuttons,
buttonstatus,
numberpresses,
pointercol,
pointerrow;
char numbuf[3];
/* test ether mouse driver is installed */
if(!mouinstalled())
{
_outtext("SORRY-- a mouse must be installed");
exit(1);
}
_clearscreen(_GCLEARSCREEN);
moureset(&numbuttons);
moushowpointer();
printf("+------------------------------------+\n");
printf("| MENU 1 | MENU 2 | QIUT |\n");
printf("+------------------------------------+\n");
printf("pointer column: xx row: xx |"
" left button: right button: \n");
for(;;)
{
mougetbuttonpress
(0,
&buttonstatus,
&numberpresses,
&pointercol,
&pointerrow);
pointercol /= 8;
pointerrow /= 8;
_settextposition(5,16);
sprintf(numbuf,"%2d",pointercol);
printf(numbuf);
_settextposition(5,27);
sprintf(numbuf,"%2d",pointerrow);
printf(numbuf);
_settextposition(5,41);
printf(buttonstatus & LEFTBUTTONDOWN ? "DOWN":"UP ");
_settextposition(5,55);
printf(buttonstatus & RIGHTBUTTONDOWN ? "DOWN":"UP ");
_settextposition(11,12);
printf("menone is %c",menone);
if(numberpresses > 0 && pointerrow == 1)
{
if(pointercol >= 1 && pointercol <= 12)
menu1();
else
if(pointercol >= 14 && pointercol <= 25)
menu2();
else
if(pointercol >= 27 && pointercol <= 36)
{
moureset(&numbuttons);
_clearscreen(_GCLEARSCREEN);
exit(0);
}
} /* end if numberpresses > 0 */
} /* end for */
} /* end main */
void menu1(void)
{
mouhidepointer();
_settextposition(12,12);
if(menone == 'n')
{
printf("menu 1 on ");
menone = 'y';
}
else
/* if(menone == 'y') */
{
printf("menu 1 off");
menone = 'n';
}
moushowpointer();
} /* end menu1 */
void menu2(void)
{
mouhidepointer();
_settextposition(12,12);
if(menone == 'n')
{
printf("menu 2 on ");
menone = 'y';
}
else
/* if(menone == 'y') */
{
printf("menu 2 off");
menone = 'n';
}
moushowpointer();
} /* end menu2 */